<template>
    <button @click="show = !show">
        显示/隐藏
    </button>
    <transition name="slide" class="dv">
        <div v-if="show" >滑动进入效果</div>
    </transition>
</template>
<script setup>
import { ref} from 'vue';

let show = ref(false);
</script>
<style scoped>
.dv {
    margin-top: 20px;
    padding: 30px;
    width: 200px;
    background-color: cyan;
    color: rgb(255, 60, 0);
}

.slide-enter-active {
    transition: all 5s ease-out;
}

.slide-leave-active {
    transition: all 5s ease-in;
}

.slide-enter-from{
    transform: translateX(500px);
    opacity: 0;
}

.slide-leave-to {
    transform: translateY(500px);
    opacity: 0;
}
</style>